From 84aed002bd8227fc75744a1882bc2a1c2e26173c Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Mon, 8 Mar 2004 17:46:38 +0000 Subject: [PATCH] Added 'all' option to position filter --- gpsbabel/README | 2 ++ gpsbabel/position.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/gpsbabel/README b/gpsbabel/README index 5f47e9ce5..84cea124f 100644 --- a/gpsbabel/README +++ b/gpsbabel/README @@ -543,6 +543,8 @@ DATA FILTERS would remove multiple points that are within 1 foot of each other, leaving just one. + You can also specify the "all" option, which would remove all + of the points rather than leaving one. RADIUS diff --git a/gpsbabel/position.c b/gpsbabel/position.c index f1100bcfa..e5273ed2e 100644 --- a/gpsbabel/position.c +++ b/gpsbabel/position.c @@ -29,6 +29,7 @@ extern queue waypt_head; static double pos_dist; static char *distopt; +static char *purge_duplicates = NULL; static char *latopt; static char *lonopt; static char *exclopt; @@ -44,6 +45,7 @@ static arglist_t position_args[] = { {"distance", &distopt, "Maximum positional distance", ARGTYPE_FLOAT | ARGTYPE_REQUIRED }, + {"all", &purge_duplicates, "Suppress all points close to other points", ARGTYPE_BOOL }, {0, 0, 0, 0} }; @@ -125,6 +127,7 @@ position_process(void) waypoint ** comp; double dist; int i, wc; + int del = 0; wc = waypt_count(); @@ -151,7 +154,17 @@ position_process(void) if (dist <= pos_dist) { waypt_del(comp[i]); waypt_free(comp[i]); + del = !!purge_duplicates; } + else if (del ) { + waypt_del(comp[i]); + waypt_free(comp[i]); + del = 0; + } + } + if ( del ) { + waypt_del(comp[wc-1]); + waypt_free(comp[wc-1]); } if (comp) -- 2.30.2